﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace hse_2013_zavyalovalevina
{
    public partial class SearchWorkerForm : Form
    {

        private List<iWorker> WorkersList = new List<iWorker>();

        public SearchWorkerForm(List<iWorker> WorkersList)
        {
            InitializeComponent();
            Bitmap animatedImage = new Bitmap("adog.gif");

            pictureBox1.Image = animatedImage;
            this.WorkersList = new List<iWorker>(WorkersList);
            toolTip1.SetToolTip(groupBox1, "Выделите сотрудника для просмотра обязанностей");
            ReloadInformation();

        }
        private void ReloadInformation()
        {
            dataGridView1.DataSource = new List<Worker>();
            dataGridView1.DataSource = WorkersList;
            dataGridView1.Columns[0].HeaderText = "ФИО";

            dataGridView1.Columns[1].HeaderText = "Дата рождения";
            dataGridView1.Columns[2].HeaderText = "Должность";
            dataGridView1.Columns[3].HeaderText = "Опыт работы";
            dataGridView1.Columns[4].HeaderText = "Количнество подчиненных";

            dataGridView1.Columns[0].Width = 200;
            dataGridView1.Columns[1].Width = 70;
            dataGridView1.Columns[2].Width = 90;
            dataGridView1.Columns[3].Width = 90;
            dataGridView1.Columns[4].Width = 90;
        }

        private void SearchWorkerForm_Load(object sender, EventArgs e)
        {

        }


        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count != 0)
            {
                richTextBox1.Text = WorkersList[dataGridView1.SelectedRows[0].Index].getResponsibility();

            }
            else
                richTextBox1.Text = "";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

    }
}
